package exec

import (
	"go.uber.org/multierr"
	"syscall"
)

func SetPgid(pid, pgid int) error {
	return syscall.Setpgid(pid, pgid)
}

func GetPPids(pid int) ([]int, error) {
	return []int{}, nil
}

func Kill(pids []uint32) error {
	var errs error
	for _, pid := range pids {
		if err := syscall.Kill(int(pid), syscall.SIGKILL); err != nil {
			errs = multierr.Append(errs, err)
		}
	}
	return errs
}

func KillAll(pid int) error {
	return syscall.Kill(pid-(pid*2), syscall.SIGKILL)
}
